import request from "./service/index"

App({
   onLaunch() {
    const menuButtonInfo = wx.getMenuButtonBoundingClientRect();
    this.globalData.menuButtonHeight = menuButtonInfo.height
    this.globalData.menuButtonLeft = menuButtonInfo.left
    this.globalData.menuButtonTop = menuButtonInfo.top
    this.globalData.menuButtonBottom = menuButtonInfo.bottom
    const windowInfo =wx.getWindowInfo();
    // 状态栏高度（单位：px）
    const statusBarHeight = windowInfo.statusBarHeight;
    this.globalData.menuMargin = this.globalData.menuButtonTop - statusBarHeight;
    const token = wx.getStorageSync('token') 
    if (token) {
      this.globalData.isLogin = true
    }
  },
  // 全局数据
  globalData: {
    menuMargin: -1, // 胶囊顶部Maring
    menuButtonHeight: -1, // 胶囊高度
    menuButtonTop: -1, // 胶囊顶部间距
    menuButtonLeft: -1, // 胶囊左方大小
    menuButtonBottom: -1, // bottom：胶囊按钮下边缘距离屏幕顶部的距离（px）
    isLogin: false, // 用户是否登录
    orderInfo: {} // 订单全局数据
  },
})